//    uniCenta oPOS - touch friendly EPoS
//    Copyright (c) 2009 uniCenta
//    http://www.unicenta.net
//
//    This file is part of uniCenta oPOS
//
//    uniCenta oPOS is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    uniCenta oPOS is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with uniCenta oPOS.  If not, see <http://www.gnu.org/licenses/>.

report = new com.openbravo.pos.reports.PanelReportBean();

report.setTitleKey("Menu.TimeSeriesProduct");
report.setReport("/com/openbravo/reports/timeseriesproduct");
report.setResourceBundle("com/openbravo/reports/timeseriesproduct_messages");

report.setSentence(
"SELECT " +
" CATEGORIES.NAME AS CATNAME, " +
" PRODUCTS.NAME AS PRODUCT, " +
" PRODUCTS.IMAGE AS PRODIMG, " +
" PRODUCTS.REFERENCE AS REF, " +
" PRODUCTS.CODE AS BARCODE, " +
" PRODUCTS.PRICEBUY, " +
" PRODUCTS.PRICESELL, " +
" PRODUCTS.STOCKCOST, " +
" PRODUCTS.STOCKVOLUME, " +
" TC.ID AS TAXCAT, " +
" TC.NAME AS TAXCATNAME, " +
" PEOPLE.NAME AS SALER, " +
" RECEIPTS.DATENEW AS RECEIPTDATE, " +
" SUM(TICKETLINES.UNITS) AS TOTALUNIT " +
"FROM " +
" RECEIPTS LEFT OUTER JOIN TICKETS ON " +
" RECEIPTS.ID = TICKETS.ID LEFT OUTER JOIN TICKETLINES ON " +
" TICKETS.ID = TICKETLINES.TICKET, " +
" PRODUCTS LEFT OUTER JOIN CATEGORIES ON " +
" PRODUCTS.CATEGORY = CATEGORIES.ID LEFT OUTER JOIN TAXCATEGORIES TC ON " +
" PRODUCTS.TAXCAT = TC.ID, " +
" PRODUCTS_CAT, " +
" PEOPLE " +
"WHERE " +
" PRODUCTS.ID = TICKETLINES.PRODUCT AND PEOPLE.ID = TICKETS.PERSON AND PRODUCTS.ID = PRODUCTS_CAT.PRODUCT AND ?(QBF_FILTER) " +
"GROUP BY " +
" PRODUCTS.ID, " +
" DAY(RECEIPTS.DATENEW), " +
" PEOPLE.ID " +
"ORDER BY " +
" CATEGORIES.NAME, " +
" PRODUCTS.NAME, " +
" RECEIPTS.DATENEW, " +
" PEOPLE.NAME");
report.addParameter("RECEIPTS.DATENEW");
report.addParameter("RECEIPTS.DATENEW");
report.addQBFFilter(new com.openbravo.pos.reports.JParamsDatesInterval());
report.addParameter("PRODUCTS.NAME");
report.addParameter("PRODUCTS.PRICEBUY");
report.addParameter("PRODUCTS.PRICESELL");
report.addParameter("PRODUCTS.CATEGORY");
report.addParameter("PRODUCTS.CODE");
report.addQBFFilter(new com.openbravo.pos.ticket.ProductFilter());

report.addField("CATNAME", com.openbravo.data.loader.Datas.STRING);
report.addField("PRODUCT", com.openbravo.data.loader.Datas.STRING);
report.addField("PRODIMG", com.openbravo.data.loader.Datas.IMAGE);
report.addField("REF", com.openbravo.data.loader.Datas.STRING);
report.addField("BARCODE", com.openbravo.data.loader.Datas.STRING);
report.addField("PRICEBUY", com.openbravo.data.loader.Datas.DOUBLE);
report.addField("PRICESELL", com.openbravo.data.loader.Datas.DOUBLE);
report.addField("STOCKCOST", com.openbravo.data.loader.Datas.DOUBLE);
report.addField("STOCKVOLUME", com.openbravo.data.loader.Datas.DOUBLE);
report.addField("TAXCAT", com.openbravo.data.loader.Datas.STRING);
report.addField("TAXCATNAME", com.openbravo.data.loader.Datas.STRING);
report.addField("SALER", com.openbravo.data.loader.Datas.STRING);
report.addField("RECEIPTDATE", com.openbravo.data.loader.Datas.TIMESTAMP);
report.addField("TOTALUNIT", com.openbravo.data.loader.Datas.DOUBLE);

report;

